Russian Math Olympiad Question | How to solve this